﻿#define _CRT_SECURE_NO_WARNINGS
//https ://www.lanqiao.cn/problems/19709/learning/?page=1&first_category_id=1&status=2
#include <stdio.h>
int judge(int n);
int main()
{
	int N, i, j, x = 0, count, num;
	scanf("%d", &N);
	for (i = 1; i <= N; i++)
	{
		count = 1;                  //count用于表示位数
		j = i;
		while (j > 0)
		{
			if (count % 2 != 0)
			{
				num = j % 10;            //获取个位数
				if (judge(num) == 0)
				{
					count++;
					j = j / 10;            //将原数去掉个位数后得到一个新的数
				}
				else
				{
					break;
				}
			}
			else
			{
				num = j % 10;
				if (judge(num) == 1)
				{
					count++;
					j = j / 10;
				}
				else
				{
					break;
				}
			}
		}
		if (j == 0)
		{
			x++;
		}
	}
	printf("%d", x);
	return 0;
}
int judge(int n)            //判断参数是奇数还是偶数
{
	int con;
	if (n % 2 == 0)
	{
		con = 1;
	}
	else
	{
		con = 0;
	}
	return con;
}
